module game {
	/**
	 * 页面2
	 * @author caizj
	 *
	 */
	export class SwiperPage2 extends BaseSwiper{
        private bg: egret.Bitmap;//背景
        private game_logo: egret.Bitmap;//游戏logo
        private game_slogan: egret.Bitmap;//游戏slogan
                
        public constructor() {
            super();
        }
                
        public activate(): void { 
            if(this.isActive) return;
                        
            super.activate();
//            console.log("激活page2");
            if(this.bg == null) { 
                this.bg = this.createBitmapByName("page2_bg_png");
                this.addChild(this.bg);
                this.bg.x = this.bg.y = 0;
            }
            if(this.game_logo == null) { 
                this.game_logo = this.createBitmapByName("page2_logo");
                this.addChild(this.game_logo);           
            }
            if(this.game_slogan == null) { 
                this.game_slogan = this.createBitmapByName("page2_slogan");
                this.addChild(this.game_slogan);           
            }
            //从上面落入
            this.game_logo.x =0;
            this.game_logo.y = -500;
            this.game_logo.visible = true;
            
            //从下放弹出
            this.game_slogan.x =0;
            this.game_slogan.y = 500;
            this.game_slogan.visible = true;
                     
            //入场动画   
            egret.Tween.get(this.game_logo).to({y:0}, 500,egret.Ease.bounceOut).call(this.onTweenOver, this, [this.game_logo]);
            egret.Tween.get(this.game_slogan).to({y:0}, 500,egret.Ease.bounceOut).call(this.onTweenOver, this, [this.game_slogan]); 
                      
            //播放入场音效
            this.playSound("bg");
        }
                
        public deactivate(): void { 
            if(!this.isActive) return;
                                    
            super.deactivate();
//            console.log("静止page2");
                        
            if(this.bg == null) { 
                this.bg = this.createBitmapByName("page2_bg_png");
                this.addChild(this.bg);
            }
            if(this.game_logo) { 
                this.game_logo.visible = false;
            }
            if(this.game_slogan) { 
                 this.game_slogan.visible = false;
            }
        }
	}
}
